import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from window import Ui_MainWindow
import numpy as np


class MainWidow(QMainWindow, Ui_MainWindow):
    def __init__(self):
        super(MainWidow, self).__init__()
        self.setupUi(self)
        self.init()

        self.timer = QTimer()
        self.timer.timeout.connect(self.update)
        self.timer.start(50)

        self.data = np.random.normal(size=(10, 1000))
        self.ptr = 0

    def init(self):
        self.plot = self.widget.addPlot()
        # self.plot.setYRange(-100, 100)
        self.plot.setMouseEnabled(x=False, y=False)
        self.plot.showAxes(True,
                           showValues=(False, False, False, True),
                           size=20)
        self.curve = self.plot.plot(pen='r')

    def update(self):
        self.curve.setData(self.data[self.ptr % 10])
        self.curve.setPos(self.ptr, 0)

        self.ptr += 1


if __name__ == "__main__":
    app = QApplication(sys.argv)
    window = MainWidow()
    window.show()
    sys.exit(app.exec_())
